<!DOCTYPE html>
<html>
<head>
<!-- 	<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css"> -->

  <link rel="stylesheet" href="../../static/css/font-awesome.4.6.0.css">

	<link href="../../static/css/froala_editor.min.css" rel="stylesheet" type="text/css">


    <style>
        body {
            text-align: center;
            background-color: #d0c0c0;
        }

        section {
            width: 80%;
            margin: auto;
            text-align: left;
        }

    </style>
</head>

<body>
   

  <section id="editor">
      <div id='edit' style="margin-top: 30px;">


          <h1>问题内容请写在这里~</h1>

          
      </div>
  </section>
  <br/>
    <br/>
  <div id="number" style="color:blue;size:"200px">问题优先级请选择：<select id="num"></select></div>
    <br/>
    <br/>
  
  <div style="text-align: center;"><button type="button" id="show_news" style="background-color: #009688;border: none;color: #fff; width:80px;height:38px">提交</button>&emsp;  &emsp; <button type="button" id="turnback" style="background-color: #009688;border: none;color: #fff; width:80px;height:38px">返回</button></div>
<script src="../../static/js/jquery-1.10.2.js"></script>
  <script src="../../static/js/froala_editor.min.js"></script>
  <!--[if lt IE 9]>
    <script src="../js/froala_editor_ie8.min.js"></script>
  <![endif]-->
  <script src="../../static/js/plugins/tables.min.js"></script>
  <script src="../../static/js/plugins/lists.min.js"></script>
  <script src="../../static/js/plugins/colors.min.js"></script>
  <script src="../../static/js/plugins/media_manager.min.js"></script>
  <script src="../../static/js/plugins/font_family.min.js"></script>
  <script src="../../static/js/plugins/font_size.min.js"></script>
  <script src="../../static/js/plugins/block_styles.min.js"></script>
  <script src="../../static/js/plugins/video.min.js"></script>

  <script>
	$(function(){
	  $('#edit').editable({inlineMode: false, alwaysBlank: true})
	});
	
	for (var i=1;i<100;i++)
  {
    $("#num").append('<option value ="'+i+'">'+i+'</option>');
  }
  
  $("#show_news").on("click",function(){

    console.log($(".froala-element").html());
    
    var news_html = $(".froala-element").html()
    var priority = $("#num option:selected").html();  
    
    params = {
      "news_html":news_html,
      "priority":priority,
    }
    
    $.ajax({      
      url:"/app/questions/add",
      type:"POST",
            data:JSON.stringify(params),
            contentType:'application/json',
      success:function(res){
                if(res.status == 0){
          alert("问题添加成功");
                    location.href="/app/show/questions_list";
                }else {
                    alert(res.msg);
                }
            }
    
    });
  })
	

  $("#turnback").on("click",function(){
    
    location.href="/app/show/questions_list";
  });

  </script>
</body>


</html>
